<?php
/**
 * Created by PhpStorm.
 * User: alexey
 * Date: 8/3/14
 * Time: 2:50 PM
 */

if (isset($_GET['lang'])) {
  session_start();

  switch ($_GET['lang']) {
    case "rus":
      $_SESSION['lang'] = 'lang.rus';
      break;
    case "eng":
      $_SESSION['lang'] = 'lang.eng';
      break;
    default:
      $_SESSION['lang'] = 'lang.eng';
      break;
  }

  if ($_SESSION['id'] != '') {
    setUserLanguage($_GET['lang']);
  }
}

redirect($_SERVER['HTTP_REFERER']);